package com.chinacoal.microservice.api;

import java.util.List;

import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.api.fallback.TaskExtAttrMapRegisterClientFallback;
import com.chinacoal.microservice.api.model.QueryUtaskCatAttrMapParam;
import com.chinacoal.microservice.api.model.entity.UtaskCatAttrMapEntity;
import com.chinacoal.microservice.model.common.Entity.InsertValid;
import com.chinacoal.microservice.model.common.Entity.UpdateValid;
import com.chinacoal.microservice.util.result.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(tags = {"待办类型映射管理接口"})
@FeignClient(name = "ccms-union-task", configuration = FeignAutoConfiguration.class, fallback = TaskExtAttrMapRegisterClientFallback.class)
public interface TaskExtAttrMapRegisterClient {

    @ApiOperation(value = "新增待办类型映射")
    @PostMapping("/uniontask/catAttrMap/add")
    public Result<Object> insert(@Validated({InsertValid.class}) @RequestBody UtaskCatAttrMapEntity utaskCatAttrMapEntity);
	
    @ApiOperation(value = "修改待办类型映射")
    @PutMapping("/uniontask/catAttrMap/update")
    public Result<Object> update(@Validated({UpdateValid.class}) @RequestBody UtaskCatAttrMapEntity utaskCatAttrMapEntity);
    
    @ApiOperation(value = "删除待办类型映射")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "mapId", value = "主键id", required = true, dataType = "String")
    })
    @DeleteMapping("/uniontask/catAttrMap/del/{mapId}")
    public Result<Object> delete(@PathVariable("mapId") String mapId);
    
    @ApiOperation(value = "查询待办类型映射列表")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType="path", name = "page", value = "当前页码", required = true, dataType = "int"),
        @ApiImplicitParam(paramType="path", name = "pageSize", value = "每页记录数", required = true, dataType = "int")
    })
    @PostMapping("/uniontask/catAttrMap/{page}/{pageSize}")
    public Result<Page<UtaskCatAttrMapEntity>> findList(@PathVariable("page") Integer page,
										   		  @PathVariable("pageSize") Integer pageSize,
										   		  @RequestBody QueryUtaskCatAttrMapParam param);
    
    @ApiOperation(value = "查询待办类型映射详情（按主键id）")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="path", name = "mapId", value = "主键id", required = true, dataType = "String")
    })
    @GetMapping("/uniontask/catAttrMap/{mapId}")
	public Result<UtaskCatAttrMapEntity> findOne(@PathVariable("mapId") String mapId);

    @ApiOperation(value = "查询待办类型映射（按应用、类型、属性）")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType="query", name = "sysId", value = "应用Id", required = true, dataType = "String"),
    	@ApiImplicitParam(paramType="query", name = "catId", value = "待办类型Id", required = false, dataType = "String"),
    	@ApiImplicitParam(paramType="query", name = "attrId", value = "待办类型属性Id", required = false, dataType = "String")
    })
    @GetMapping("/uniontask/catAttrMap/getCatAttrMap")
	public Result<List<UtaskCatAttrMapEntity>> getCatAttrMap(@RequestParam(value = "sysId",required = true) String sysId,
													   		 @RequestParam(value = "catId",required = false) String catId,
													   		 @RequestParam(value = "attrId",required = false) String attrId);
}
